package com.hzlj.position.config.dao;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.fz.common.base.converter.QueryWrapperConverterPlus;
import com.hzlj.position.config.common.dto.noticeConfig.NoticeConfigQueryResultDTO;
import com.hzlj.position.config.common.model.NoticeConfig;
import com.hzlj.position.config.mapper.NoticeConfigMapper;
import org.springframework.stereotype.Repository;

import javax.annotation.Resource;

/**
 * 通知配置(NoticeConfig)表操作类
 *
 * @author lifh
 * @date 2023-07-18 12:01:40
 */
@Repository
public class NoticeConfigDao extends ServiceImpl<NoticeConfigMapper, NoticeConfig> {
    @Resource
    private NoticeConfigMapper noticeConfigMapper;


    public NoticeConfigQueryResultDTO getNoticeConfigByJgCode(String jgCode) {
        return QueryWrapperConverterPlus.of(noticeConfigMapper)
                .selectOne(NoticeConfigQueryResultDTO.class, null, null, q -> {
                    q.apply("'" + jgCode + "' LIKE CONCAT(jg_code, '%')")
                            .orderByDesc(NoticeConfig::getJgCode);
                });
    }
}

